<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>springmvcuploadftp图片上传</title>
<link href="${pageContext.request.contextPath}/jslib/kindeditor/themes/default/default.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="${pageContext.request.contextPath}/jslib/jquery/jquery-3.3.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/jslib/kindeditor/kindeditor-all-min.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/jslib/kindeditor/lang/zh-CN.js"></script>
</head>
<body>
<h3>测试上传图片功能接口的form表单1</h3>
    <form action="pic/upload" method="post" enctype="multipart/form-data">
	    <input type="file" name="fileUpload" />
	    <input type="submit" value="上传文件" />
    </form>
    <hr />
    <br>
    <h3>测试上传图片功能接口的form表单2</h3>
    <form action="pic/upload2" method="post" enctype="multipart/form-data">
	    <input type="file" name="fileUpload" />
	    <input type="submit" value="上传文件" />
    </form>
    <br>
    <hr>
    <h3>借用KindEditor富文本编辑器实现批量上传图片</h3>
    <textarea id="kindEditorDesc" style="width:800px;height:300px;visibility:visable;"></textarea>
    <script type="text/javascript">
		$(function(){
			//初始化富文本编辑器
			KindEditor.create("#kindEditorDesc", {
				// name值，必须和Controller 的参数对应，不然会提示 400 的错误
				filePostName : "fileUpload",
				// action值，
				uploadJson : 'pic/upload',
				// 设置上传类型，分别为image、flash、media、file
				dir : "image"
			});
		});
	</script> 
	<br>
    <hr>
        <h3>借用KindEditor富文本编辑器实现批量上传图片2</h3>
    <textarea id="kindEditorDesc2" style="width:800px;height:300px;visibility:visable;"></textarea>
    <script type="text/javascript">
		$(function(){
			//初始化富文本编辑器
			KindEditor.create("#kindEditorDesc2", {
				// name值，必须和Controller 的参数对应，不然会提示 400 的错误
				filePostName : "fileUpload",
				// action值，
				uploadJson : 'pic/upload2',
				// 设置上传类型，分别为image、flash、media、file
				dir : "image",
				afterUpload : function(url) {
                    alert(url);
            	}
			});
		});
	</script> 
</body>
</html>